package com.jinzhi.jinzhidata.repository;

import com.jinzhi.jinzhidata.dataobject.Order;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author vansl
 */
@Repository
public interface OrderRepository extends JpaRepository<Order, String> {

    Order findByOrderUserIdAndOrderGoodsId(String userId, String orderGoodsId);

    @Query(value = "select order_goods_id from t_order where order_user_id = :userId", nativeQuery = true)
    List<String> selectGoodsIdListByUser(String userId);
}
